<?php
session_start();
require_once( "../includes/config.php");
include  $rootPath."includes/global.php";
include $rootPath."lib/xtpl.php";
include $rootPath."classes/db.php";
include $rootPath."classes/gui.php";
////////////////
$DB = new DBCLASS();
///////////////
$id = $_GET['id'];
$countsql="SELECT COUNT(*) FROM {$DP}news";

$rs= mysql_query($countsql);
$countrow=mysql_fetch_array($rs);
$count=$countrow[0];

if ($count > 0){
	
	$sql="SELECT * FROM ".$DP."news ORDER BY news_id DESC  LIMIT 0,10";
	$rs=mysql_query($sql);
	$string='<table width="100%" border="0" cellspacing="0" cellpadding="0" >';
	while($row=mysql_fetch_assoc($rs)){
		//--
		//--
		$headline='<tr>
					<td class="headline" align="left" style="padding:5px 5px 5px 5px">
						'.CreateBox($row).'
					</td>
				</tr>';
		
		$string .=$headline; 
		}
		
		$string ='<div id="datacontainer" style="position:absolute;left:1px;top:10px;width:100%" onMouseover="scrollspeed=0" onMouseout="scrollspeed=cache">'.$string.'</table></div>';


}
else{
	$string='<div id="datacontainer" style="position:absolute;left:1px;top:10px;width:100%" onMouseover="scrollspeed=0" onMouseout="scrollspeed=cache" class="story">Không tìm thấy bản ghi</div>';
}
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Wall Vietnam :: News</title><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><meta http-equiv="Pragma" content="no-cache" /><meta name="ROBOTS" content="index,follow" /><meta http-equiv="Content-Language" content="en-gb" /><meta http-equiv="Content-Script-Type" content="text/javascript" /><meta name="Author" content="Pyro Game Development Ltd" />'.'<meta name="Copyright" content="www.onlinefiresafetytraining.co.uk/index.php?page=terms" />'.
						'<meta name="Distribution" content="GLOBAL" />'.
						'<meta name="doc-class" content="Wall Vietnam" />'.
						'<meta name="doc-rights" content="Wall Vietnam" />'.
						'<meta name="Owner" content="Wall Vietnam" />'.
						'<meta name="Rating" content="General" />'.
						'<meta name="revisit-after" content="1 Days" />'.
						'<meta name="resource-type" content="document" />'.
						'<link href="'.$base_url.'templates/layout/css/style.css" rel="stylesheet" type="text/css" />'.
						'<link href="../favicon.ico" type="Shortcut Icon" /></head><body style="background-color:transparent">' .$string.'</body></html>';
function CreateBox($row){
	global $id,$cate_path_2,$cate_path_1;
	if($row['news_image']!='' && file_exists("../upload/news/thumb".$row['news_image'])){
	$text='
			<table width="100%" border="0" cellspacing="0" cellpadding="0">
			  <tr>
				<td width="65" align="left" valign="top">
					<a href="../?act=news&amp;id='.$row['news_id'].'" class="rolling_block" target="_top" title="'.$row['news_title'].'"><img src="../upload/news/thumb'.$row['news_image'].'" width="60" alt="Image" border="0"></a></td>
				<td valign="top" align="left" >
					<a href="../?act=news&amp;id='.$row['news_id'].'" class="rolling_block" target="_top" title="'.$row['news_title'].'">&nbsp;'.stripslashes($row['news_title']).'</a><br />
				</td>
			  </tr>
			</table>
		 ';
	}
	else{
		$text='
			<table width="100%" border="0" cellspacing="0" cellpadding="0">
			  <tr>
				<td valign="top" align="left" >
					<a href="../?act=news&amp;id='.$row['news_id'].'" class="rolling_block" target="_top" title="'.$row['news_title'].'">&nbsp;'.stripslashes($row['news_title']).'</a><br />
				</td>
			  </tr>
			</table>
		 ';
	}
	return $text;
}
?>
<script type="text/javascript">

//Specify speed of scroll. Larger=faster (ie: 5)
var scrollspeed=cache=1

//Specify intial delay before scroller starts scrolling (in miliseconds):
var initialdelay=500

function initializeScroller(){
dataobj=document.all? document.all.datacontainer : document.getElementById("datacontainer")
dataobj.style.top="5px"
setTimeout("getdataheight()", initialdelay)
}

function getdataheight(){
thelength=dataobj.offsetHeight
if (thelength==0)
setTimeout("getdataheight()",10)
else
scrollDiv()
}

function scrollDiv(){
dataobj.style.top=parseInt(dataobj.style.top)-scrollspeed+"px"
if (parseInt(dataobj.style.top)<thelength*(-1))
dataobj.style.top="145px"
setTimeout("scrollDiv()",100)
}

if (window.addEventListener)
window.addEventListener("load", initializeScroller, false)
else if (window.attachEvent)
window.attachEvent("onload", initializeScroller)
else
window.onload=initializeScroller


</script>